//LTROP ST - LWFL

cshapea1 = (r180=="no") ? "rr2" : "rr4";

screen_openings=[
//       ID, shape, height, width, corner,     x,      y, cut | build, anchor, surface, length, thickness, [edge_slopes], [special parms]
[    "left",   "r", ucbh+2,    18,      0,     1, ucbb-1,           0,    "L",     "T",      0,         0,            [],              [] ],
[  "fillet", "oa4",      0,     0,      3,    19,   umbb,           0,    "L",     "T",      0,         0,            [],              [] ],
[   "right",   "r", ucbh+2,    18,      0, sw-19, ucbb-1,           0,    "L",     "T",      0,         0,            [],              [] ],
[  "fillet", "oa1",      0,     0,      3, sw-19,   umbb,           0,    "L",     "T",      0,         0,            [],              [] ],
];

case_openings=[
// ID, shape, height, width, corner,      x,          y, cut | build, anchor, surface, length, thickness, [edge_slopes], [special parms]
[   1,   "r",   12.3,    10,      0, xors-5, coh/2-6.15,           0,    "L",     "T",      0,         0,            [],              [] ],
];

case_additions=[
// ID,    shape, height, width, corner,    x,     y, cut | build, [trim]
[   0, cshapea1,     39,  2.75,      6, xors, coh/2,           0,     [] ],
];

tablet_openings=[
// ID, shape, height, width, corner,    x,    y, cut | build, anchor, surface, length, thickness, [edge_slopes], [special parms]
[   0,   "r",      0,     0,      0,    0,    0,           0,    "L",     "T",      0,         0,            [],              [] ],
];


/*********** Column Usage
  All shapes require values in the x and y columns.

** Screen, Case, Tablet Openings
  Shape      height  width  corner  cut | build  anchor  surface  length  thickness  [edge slopes]  [special params]
  r            x       x      x          x         x        x                              x               x
  c            x                         x                  x                              x               x
  hd           x       x                 x         x        x                              x               x
  oa1-4                       x          x
  text         x                         x                  x                                              x
  svg          x       x                 x                                                                 x
  bump         x
  ridge                                  x         x                x         x                            x
  hridge                                 x         x                x         x
  vridge                                 x         x                x         x
  cridge       x                         x                                    x
  rridge       x       x      x          x         x                          x
  aridge1-4                              x                                    x

  [special params]  Contents
  r, c, hd          [direction]
  text              ["text value", direction, font style, h-align, v-align]
  svg               ["filename", direction]
  ridge             [direction]

** Case Additions
  Shape   height  width  corner  cut | build  [trim]
  r         x       x      x          x         x
  c         x                         x         x
  r1-4      x       x      x          x         x
  tab1-4    x       x      x          x         x
  cm1-4     x       x                 x         x
  t1-4      x       x                 x         x
  f1-4      x       x      x          x         x
  oa1-4                    x
  ped1-4



/***********SCREEN VARIABLES
These special variables can be used to locate screen openings relative to the (0,0) location of the screen opening region

** screen variables
	sh 	screen height (the value is in millimeters or pixels as appropriate)
	sw	screen width (the value is in millimeters or pixels as appropriate)

	mpp	millimeters per pixel	
	ppm	pixels per millimeter

	nr	number of rows in grid
	nc	number of columns in grid

** app variables (the value is in millimeters or pixels as appropriate)
	sbh	status bar height
	umbh	upper message bar height
	ucbh	upper command bar height
	lmbh	lower message bar height
	lcbh	lower command bar height

	sbb	status bar bottom
	umbb	upper message bar bottom
	ucbb	upper command bar bottom
	lmbt	lower message bar top
	lmbb	lower message bar bottom
	lcbb	lower command bar bottom
	
** grid variables (the value is in millimeters or pixels as appropriate)
	gw	grid width
	gh	grid height
	gt 	grid top
	gb	grid bottom

	tp	top padding - specified in Grid Special Settings
	bp	bottom padding - specified in Grid Special Settings
	lp	left padding - specified in Grid Special Settings
	rp	right padding - specified in Grid Special Settings
	
** cell variables (the value is in millimeters)
	cw	cell width (doesn't apply to cells that are affected by left/right compensation for tight cases)
	ch	cell height (doesn't apply to cells that are affected by top/bottom compensation for tight cases)
	ccr	cell corner radius

	hor	height of ridge - specified in Grid Special Settings
	tor	thickness of ridge - specified in Grid Special Settings




/***********CASE VARIABLES
These special variables can be used to locate openings and place additions relative to the (0,0) location of the case opening
[Note that the (0,0) location of the case opening is not absolute and can move if the screen doesn't sit in the middle of the opening.  These variables are independent of that movement. All variables are in millimeters]
	coh	case opening height - specified in Case Info
	cow 	case opening width - specified in Case Info
	cocr	case opening corner radius - specified in Case Info

	kh	keyguard height - specified in Keyguard Frame Info
	kw	keyguard width - specified in Keyguard Frame Info
	kcr	keyguard corner radius - specified in Keyguard Frame Info
	rh	rail height (also keyguard thickness)
	hrw	horizontal rail width
	vrw	vertical rail width

	lcow	the default width of the left side of case opening when in landscape mode
	bcoh	the default height of the bottom side of case opening when in landscape mode

	c_h	case height
	c_w	case width
	c_cr	case corner_radius
	ctsd	case to screen_depth
	sew	sloped edge width



/***********CAMERA and HOME BUTTON VARIABLES
The designer thinks of the camera and home button as positioned relative to the edge of the screen, not the edge of the tablet or the edget of the case opening so these variables will work best in the screen_openings set of instructions. Note that all the measurements in this set are in millimeters.  If you use these in a design that assumes all screen measurements are in pixels, multiply the variable times ppm (pixels per millimeter).

	hloc	home button location: 1,2,3,4 (adjusted for orientation)
	hbd	distance from screen to home button in millimeters
	hbh	home button height in millimeters
	hbw	home button width in millimeters
	cloc	camera location: 1,2,3,4 (adjusted for orientation)
	cmd	distance from screen to camera in millimeters
	cmh	camera height in millimeters
	cmw	camera width in millimeters

	sxo	sign of x offset, if measuring from standard home/camera locations
	syo	sign of y offset, if measuring from standard home/camera locations
	
	xols	x location of the left side of the case opening adjusted for swapping camera and home button
	xors	x location of the right side of the case opening adjusted for swapping camera and home button
	yobs	y location of the bottom side of the case opening adjusted for swapping the camera and home button
	yots	y location of the top side of the case opening adjusted for swapping the camera and home button




/***********TABLET VARIABLES
	r180   "yes" or "no" whether the tablet has been rotated 180 degrees
	th     height of tablet in millimeters
	tw     width of tablet in millimeters - specified in internal designer data
	tcr    tablet corner radius in millimeters - specified in internal designer data




/************ DISPLAYING THE VALUE OF A VARIABLE
If you just want to see what the contents of a variable is you use the "echo" command and look for what is displayed in the console
pane.  For example, if you wanted to see what the designer thinks the height of the tablet is in millimeters, put this line at the
top of this file:

echo(th=th);

Don't forget the semicolon at the end of the line.  Save the file and look at the Console pane in OpenSCAD.  You should see a line that
looks something like this:

ECHO: th = 184

So the designer thinks that the height of the tablet is 184 millimeters.




/************ CREATING YOUR OWN VARIABLES
You may want to create your own variables and use them to place features of your keyguard.  For example, you may want to put a
bump between each column of cells to aid in navigation by a visually impaired individual. The distance from the left edge of the grid
to the middle of the rail between column 1 and column 2 is the width of the grid divided by the number of columns.  That looks like
this: gw/nc.  The distance to the center of the rail between column 2 and column 3 is (gw/nc)*2, and so on.  You may want a variable
that is shorter in length so that your instruction lines don't get too long.  Just create your own variables:
c1 = gw/nc;
c2 = (gw/nc)*2;
c3 = (gw/nc)*3;
c4 = (gw/nc)*4;
c5 = (gw/nc)*5;
...

Put these lines at the top of the openings_and_additions.txt file then use the variables in the "x" column.

Note: if you create a variable that is already being used in the keyguard designer, you will see a Warning message like this:

   "WARNING: c1 was assigned on line 1101 of "keyguard.scad" but was overwritten in file openings_and_additions.txt, line 1"

with a yellow background. It's telling you that you are trying to define "c1" but the keyguard designer is also trying to define it.

You will need to change the name of your variable until it doesn't collide with the keyguard designer program.


************************************************************************************************************************************/
